<?php
namespace app\admin\controller;
use think\Controller;
use app\admin\Model\Message;
use app\admin\Model\Bill as B;
use app\admin\Model\Pay;
use app\admin\Model\Number;
use think\Db;
use app\admin\validate\Stu as qbc;

class Bill extends Common
{
	
	public function list(){
		
		$list = B::with('number')->with('rom')->paginate(4);
		$page = $list->render();
	     //halt($list);
		
		return $this->fetch('list',['list'=>$list,'page'=>$page]);
	}
	public function add(){
		$bill = new B();
			
		if(input("?param.sub")){
			
			
			$result = $bill->add();
			if($result){
				$this->success("添加成功","banner/list");
			}else{
				$this->error("添加失败");
			}
		}else{
			
			//halt($list1);
			$num = new Number();
			$list = Number::all();
			//halt($list);
			$this->assign('list',$list);
			return $this->fetch();
		}
	}
	public function list1(){
	    $data = Db::table('house_rom')->where('n_id',input('param.r_id'))->select();
	    
	    return json($data);
    }

}
?>